// Copyright 2018 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-Intl.ListFormat.supportedLocalesOf
description: Verifies the type of the return value of Intl.ListFormat.supportedLocalesOf().
info: |
    Intl.ListFormat.supportedLocalesOf ( locales [, options ])
includes: [propertyHelper.js]
features: [Intl.ListFormat]
---*/

function Test() {
    const result = Intl.ListFormat.supportedLocalesOf("en");
    assert.sameValue(Array.isArray(result), true,
      "Array.isArray() should return true");
    assert.sameValue(Object.getPrototypeOf(result), Array.prototype,
      "The prototype should be Array.prototype");
    assert.sameValue(Object.isExtensible(result), true,
      "Object.isExtensible() should return true");

    assert.notSameValue(result.length, 0);
    for (let i = 0; i < result.length; ++i) {
      verifyProperty(result, String(i), {
        "writable": true,
        "enumerable": true,
        "configurable": true,
      });
    }

    verifyProperty(result, "length", {
      "enumerable": false,
      "configurable": false,
    });
}

// preheat
const NUMBER_OF_PREHEAT = 1;
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}

ArkTools.jitCompileAsync(Test);
assert.sameValue(ArkTools.waitJitCompileFinish(Test), true, '[JIT] JIT disabled.');

// test
const NUMBER_OF_TEST = 1; // or 2
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}
